#ifndef PLANET_H
#define PLANET_H

#include <string>
#include <list>

#include <NxVec3.h>
#include <NxActor.h>
#include <NxScene.h>
#include <NxForceField.h>

#include "../_Utils/src/DevilTexture.h"

class Planet
{
private:
    static const float PLANET_GRAVITATIONFIELD_RADIUS;
    static const int POSITION_POINTS_STORAGE_MAXIMUM;
    static const int POSITION_POINTS_STORAGE_DISTANCE;
    static const float DRAWING_SCALE_FACTOR;
private:
    std::string name;
    NxVec3 startPosition;
    float mass;
    float radius;
    float visualRadius;
    NxVec3 color;
    DevilTexture *texture;

    NxActor *planetActor;
    NxForceField *gravitationField;
    
    std::list<NxVec3> lastPositions;
    int lastPositionCount;
    bool isVisible;

public:
    Planet(const NxVec3 &pos, const std::string &name, float mass, float radius, float visualRadius, const NxVec3 &initialVelocity, const NxVec3 &initialAngularVelocity, const NxVec3 &color, DevilTexture *texture, NxScene *scene);
    ~Planet();

    inline NxVec3 GetPosition() { return (this->planetActor != NULL) ? this->planetActor->getGlobalPosition() : NxVec3(0.0f, 0.0f, 0.0f); }
    inline std::string GetName() { return this->name; }
    inline NxActor *GetActor() { return this->planetActor; }
    inline bool GetVisibility() { return this->isVisible; }
    inline void SetVisibility(bool isVisible) { this->isVisible = isVisible; }

    void Draw();
    void Update();
};


#endif //PLANET_H
